package internal

import (
	"time"
	"zt-compute/config"
)

type WorkforceManagement struct {
	WorkforceId string    `db:"workforce_id"`
	BeginTime   time.Time `db:"start_time"`
	EndTime     time.Time `db:"end_time"`
	DataTime    time.Time `db:"data_time"`
	ProcessId   uint32    `db:"process_id"`
}

func GetWorkForce(dataTime time.Time, startTime time.Time, endTime time.Time) []WorkforceManagement {
	var workforceManagements []WorkforceManagement
	err := config.MyConfig.SqlEngine.Select(&workforceManagements, "select workforce_id,start_time,end_time,"+
		"process_id,"+
		"data_time FROM workforce_management where data_time=$1 and start_time=$2 and end_time=$3", dataTime,
		startTime,
		endTime)
	if err != nil {
		MyLog.Error("GetWorkForce", err)
	}
	return workforceManagements
}
